import React, { useState } from 'react'
import "./Tofooter.css"
export default function Tofooter(props) {

  // let { connet, gettype, delall, changall, nochangall } = props
  let { connet, delall, changall } = props



  // let bb = gettype()
  // let changeval = (e) => {
  //   changall(e.target.checked)

  // }
  // 删除勾选的数据
  let deleteall = () => {
    delall()

  }
  let long = connet.filter((iteam) => {
    return iteam.type === true

  })

  //  批量勾选
  let allchange = () => {
    return (e) => {
      changall(e.target.checked)
    }
  }


  return (
    <div className="todo-footer">
      <label>
        <input checked={connet.every((iteam) => iteam.type) && connet.length} type="checkbox" onChange={allchange()} />
      </label>
      <span>
        <span>已完成{long.length} </span> / 全部 {connet.length}
      </span>
      <button onClick={deleteall} className="btn btn-danger">清除已完成任务</button>
    </div>
  )
}
